import Mock from 'mockjs'

const order = Mock.mock({
  'list|10': [{
    taskId: '@id',
    taskNo: '@integer(0, 5000)',
    releaseUserName: '@cname',
    taskName: '@csentence(5, 10)',
    acceptTime: '@datetime',
    'workType|1': [1, 2],
    'taskMode|1': [2, 1],
    'matchStatus|1': [2, 1],
    'taskStatus|1': [2, 1, 3, 4],
    useUserNum: '@integer(1, 100)',
    totalCost: '@integer(100, 10000)',
    distance: '@integer(100, 10000)',
    workContent: '@csentence(50)',
    taskPlace: '@county(true)',
    lng: '@string',
    lat: '@string',
    startTime: '@datetime',
    endTime: '@datetime',
    taskTime: {
      closeTime: '@datetime',
      // appraiseTime: '@datetime', // 评价
      payTime: '@datetime', // 付款
      releaseTime: '@datetime', // 已发布
      startTime: '@datetime', // 开工
      sureTime: '@datetime', // 确认
      endTime: '@datetime' // 开工
    },
    'orderList|5': [{
      taskId: '@id',
      orderNo: '@guid',
      userName: '@cname',
      userCard: '@id',
      userTel: '@integer',
      'orderUserList|3': [{
        elecId: '@guid',
        elecName: '@cname',
        elecTel: '@integer',
        elecCard: '@id',
        income: '@integer(0, 1000)',
        teamStartTime: '@datetime',
        leaveTeamTime: '@datetime',
        'orderUserStatus|1': [1, 2]
      }]
    }]
  }]
})
const pub = {
  isMore: 0,
  pageIndex: 1,
  pageSize: 10,
  startIndex: 0,
  totalNum: 30,
  totalPage: 1
}
const dictMap = {
  workType: {
    1: 'eee',
    2: 'rrr'
  },
  taskMode: {
    1: 'ttt',
    2: 'yyy'
  },
  customerType: {
    1: '22',
    2: '333'
  },
  taskStatus: {
    1: '待接单',
    2: '待开工',
    3: '待完工',
    4: '待确认'
  },
  matchStatus: {
    1: 'eee',
    2: '333'
  }
}
export default [
  // 个人派单任务列表
  {
    url: '/task/task/listTaskByCondition',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...order,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 任务详情，最基本任务信息
  {
    url: '/task/task/viewWebTaskById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {
          ...order.list[0]
        },
        dictMap,
        msg: ''
      }
    }
  }
]
